home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World Komputer 2010 April
/
PCWorld0410.iso
/
pluginy Firefox
/
8206
/
8206.xpi
/
content
/
webmail
/
yahoo.js
< prev
next >
Wrap
Text File
|
2010-02-02
|
4KB
|
177 lines
//WiseStampLog("[yahoo.js] >>>>>");
window.addEventListener("load",function(event){yahoosig.pageload(event)},true);
window.addEventListener("unload",function(event){yahoosig.uninitView(event)},true);
var yahoosig =
{
current: null,
needToInsertButton: true,
pageload: function (event)
{
try
{
wisestampsig.refreshCallback = yahoosig.refreshSignature;
setTimeout(function ()
{
yahoosig.setupCompose();
},
0);
} catch(e)
{
WiseStampLog(e);
}
},
uninitView: function ()
{
if (this.current && this["uninit" + this.current])
{
this["uninit" + this.current]();
}
},
setupCompose: function ()
{
var composeDiv = document.getElementById("tabMessageComposerBody");
var tcDiv = document.getElementById("tcDiv");
if (tcDiv || true)
{
try
{
document.addEventListener("DOMNodeInserted", yahoosig.composeInserted, false);
yahoosig.addWisestampIcon();
yahoosig.findIframesAndInsert();
} catch(e)
{
WiseStampLog(e);
}
}
},
findIframesAndInsert: function ()
{
var iframes = evaluateXPath(document, "//iframe[contains(@id,compArea_test_)]");
//WiseStampLog("iframes: len: "+iframes.length);
if (iframes && iframes.length > 0)
{
//WiseStampLog("found iframes");
for (var i = 0; i < iframes.length; i++)
{
try
{
//WiseStampLog("i: "+i+" "+iframes[i].id);
if (/compArea_test_/.test(iframes[i].id))
{
//WiseStampLog(iframes[i].id);
yahoosig.insertSignature(iframes[i]);
}
} catch(e)
{
WiseStampLog("exception caught: " + e);
}
}
}
},
composeInserted: function (event)
{
//WiseStampLog("[yahoo.js::composeInserted] >>>>>");
var match = null;
if (event.target && event.target.id)
{
//WiseStampLog("composeInserted: "+event.target.id);
if (event.target.id == "richedittoolbar")
{
setTimeout(function ()
{
yahoosig.addWisestampIcon(event.target);
},
0);
} else if ((match = event.target.id.match(/compArea_test_(.*)/)))
{
if (yahoosig.needToInsertButton)
{
setTimeout(function ()
{
yahoosig.addWisestampIcon();
},
1000);
}
yahoosig.insertSignature(event.target);
} else if ((match = event.target.id.match(/tabCompose(.*)/)))
{
setTimeout(function ()
{
yahoosig.addWisestampIcon();
yahoosig.findIframesAndInsert();
},
1000);
}
}
},
addWisestampIcon: function ()
{
//WiseStampLog("[yahoo.js::addWisestampIcon] >>>>>");
if (wisestampsig.showButton)
{
var richtoolbars = document.getElementsByTagName("div");
if (richtoolbars && richtoolbars.length > 0)
{
for (var i = 0; i < richtoolbars.length; i++)
{
var cont = richtoolbars[i];
if (/richedittoolbar/.test(cont.id))
{
var before = cont.lastChild;
var span = document.createElement("span");
span.setAttribute("id", "wisestampIcon");
span.setAttribute("class", "menuButton colorKTransparent");
var div = document.createElement("div");
div.setAttribute("unselectable", "on");
div.setAttribute("class", "button");
div.setAttribute("style", "background-image: url('" + wisestampsig.icon + "') !important; background-position: 4px 4px");
span.appendChild(div);
var inserted = cont.insertBefore(span, cont.lastChild.previousSibling); //.appendChild(table);
wisestampsig.initOptionsIcon(span);
this.needToInsertButton = false;
}
}
}
}
else this.needToInsertButton = false
},
uninitCompose: function ()
{},
iframeTries: 1,
refreshSignature: function ()
{
wisestampsig.insertSignature(yahoosig.iframe, false);
},
insertSignature: function (iframe)
{
//WiseStampLog("[yahoo.js::insertSignature] >>>>>");
this.iframe = iframe;
wisestampsig.insertSignature(yahoosig.iframe, true);
this.iframe.addEventListener('load', yahoosig.iframeLoad, false);
this.iframeLoad(false);
},
iframeLoad: function (event)
{
//WiseStampLog("iframeLoad: "+event);
var time = 500;
setTimeout(function ()
{
//WiseStampLog("iframeloadtimeout\n");
wisestampsig.insertSignature(yahoosig.iframe, true);
if (event)
{
try
{
yahoosig.iframe.removeEventListener('load', yahoosig.iframeLoad, false);
} catch(e)
{}
}
},
time);
}
};